﻿using UnityEngine;
using System.Collections;
namespace Room
{
    public class RCAINormalNPC : RCAIBase
    {

        public string animName;

        public RCAINormalNPC(RoomCharactor owner)
            :base(owner)
        {
            type = AIType.NormalNPC;
        }

        public void Init(string animName)
        {
            this.animName = animName;
        }

        public override void DoResume()
        {
            owner.PlayAnim(animName);
        }

        public override void Tick()
        {

            if (owner.IsMoving())
            {
                if (owner.lod.IsPlayingAnim("stand"))
                {
                    owner.PlayAnim("run");
                }
            }
            else
            {
                if (owner.lod.IsPlayingAnim("run") || !owner.lod.isPlayingAnim)
                {
                    owner.PlayAnim("stand");
                }
            }
        }
    }

}

